package com.meet.app.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.meet.app.R;
import com.meet.framework.base.BaseFragment;
import com.meet.framework.bmob.BmobManager;
import com.meet.framework.bmob.IMUser;
import com.meet.framework.helper.GlideHelper;
import com.meet.framework.java.SimulationData;

import java.text.SimpleDateFormat;

import de.hdodenhof.circleimageview.CircleImageView;


/**
 * FileName: MeFragment
 * Founder: LiuGuiLin
 * Profile: 我的
 */
public class MeFragment extends BaseFragment {

    private CircleImageView iv_me_photo;
    private TextView tv_nickname;
    private LinearLayout ll_me_info;
    private LinearLayout ll_new_friend;
    private LinearLayout ll_private_set;
    private LinearLayout ll_share;
    private LinearLayout ll_setting;

    private TextView tv_server_status;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_me, null);
        initView(view);
        return view;
    }

    private void initView(View view) {
        iv_me_photo = view.findViewById(R.id.iv_me_photo);
        tv_nickname = view.findViewById(R.id.tv_nickname);

        ll_me_info = view.findViewById(R.id.ll_me_info);
        ll_new_friend = view.findViewById(R.id.ll_new_friend);
        ll_private_set = view.findViewById(R.id.ll_private_set);
        ll_share = view.findViewById(R.id.ll_share);
        ll_setting = view.findViewById(R.id.ll_setting);
        tv_server_status = view.findViewById(R.id.tv_server_status);

        loadMeInfo();

    }


//    /**
//     * 加载我的个人信息
//     */
//    private void loadMeInfo() {
//        IMUser imUser = BmobManager.getInstance().getUser();
//        GlideHelper.loadSmollUrl(getActivity(), imUser.getPhoto(), 100, 100, iv_me_photo);
//        tv_nickname.setText(imUser.getNickName());
//    }


    /**
       * 加载我的个人信息
      */
    private void loadMeInfo() {
        IMUser imUser = SimulationData.getUserList().get(0);
        GlideHelper.loadSmollUrl(getActivity(), imUser.getPhoto(), 100, 100, iv_me_photo);
        tv_nickname.setText(imUser.getNickName());
    }
}
